package com.day23.Prtedicate;

import java.util.function.Predicate;

public class PredicateDemo01 {
    public static void main(String[] args) {
        boolean b1 = checkString("hello", s -> s.length() > 8);
        System.out.println(b1);
        boolean b2 = checkString("helloworld", s -> s.length() < 8);
        System.out.println(b2);
    }

    private static boolean checkString(String str, Predicate<String> predicate) {
        return predicate.test(str);
    }
}
class PredicateDemo02 {
    public static void main(String[] args) {
        boolean b1 = checkString("hello", s -> s.length() > 8, s -> s.length() < 15);
        System.out.println(b1);
        boolean b2 = checkString("helloworld", s -> s.length() < 15, s -> s.length() > 8);
        System.out.println(b2);
    }

    private static boolean checkString(String str, Predicate<String> pre1, Predicate<String> pre2) {
        return pre1.negate().test(str) && pre2.test(str);
    }
}
